<template>
     <el-menu class="el-menu-vertical-demo"  :default-active="$route.path"
              active-text-color="#409EFF"
     >
       <el-submenu
           v-for="item in hasChildren"
           :key="item.label"
           :index="item.label"
       >
         <template slot="title">
           <i :class="item.icon"></i>

           <span slot="title">{{ item.label }}</span>
         </template>
         <el-menu-item
             v-for="subitem in item.children"
             :key="subitem.path"
             :index="subitem.path"
             @click="clickMenu(subitem)"
         >
           <i :class="subitem.icon"></i>
           <span slot="title">{{ subitem.label }}</span></el-menu-item
         >
       </el-submenu>
       <el-menu-item
           v-for="item in noChildren"
           :key="item.path"
           :index="item.path"
           @click="clickMenu(item)"
       >
         <i :class="item.icon"></i>
         <span slot="title">{{ item.label }}</span>
       </el-menu-item>

     </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data(){
    return{
      menuData: [
        {
          label: '宣传管理',
          icon: 'el-icon-s-management',
          children: [{
            path: '/image',
            icon: 'el-icon-picture-outline',
            name: 'image',
            label: '图片管理',
          }]
        },
        {
          label: '线索管理',
          path: '/clue',
          icon: 'el-icon-s-grid',
          children: [{
            path: '/clue',
            icon: 'el-icon-s-grid',
            name: 'clue',
            label: '待受理',
          },
            {
              path: '/examination',
              icon: 'el-icon-s-grid',
              name: 'examination',
              label: '审查中',
            },

          ]
        },

        {
          label: '故障上报管理',
          path: "/fault",
          icon: 'el-icon-s-tools',
          name: "fault"
        },
        {
          label: "绩效考评管理",
          path: "/achievements",
          icon: 'el-icon-s-flag',

          name: 'achievements'
        },
        {
          label: '微信人员管理',
          icon: 'el-icon-user-solid',
          children: [{
            label: '个人基本信息',
            path: '/personal',
            icon: 'el-icon-user-solid',

            name: 'personal'
          },
          //   {
          //   label: '权限管理',
          //   path: '/jurisdiction',
          //   icon: 'el-icon-s-operation',
          //   name: 'jurisdiction'
          // },
            {
            label: '平台管理员管理',
            path: '/admin',
            icon: 'el-icon-menu',
            name: 'admin'
          }
          ]
        },{
          label: "平台日志",
          path: "/log",
          icon: 'el-icon-s-order',
          name:'log'
        }
      ],
      activePath:'',
    }
  },
  created() {
  },
  computed: {

    noChildren() {
      return this.menuData.filter((item) => !item.children)
    },
    hasChildren() {
      return this.menuData.filter((item) => item.children)
    }
  },
  methods:{
    getmenuList() {
  this.$axios({

  })
    },
    clickMenu(item) {
      console.log(item.path)
      this.$router.push(item.path)
    },
  }
}
</script>

<style scoped>

</style>
